package cn.iocoder.yudao.module.shop.dal.mysql.shopInfo;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.shopInfo.ShopInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.shopInfo.vo.*;

/**
 * 商户信息 Mapper
 *
 * @author 吕小文
 */
@Mapper
public interface ShopInfoMapper extends BaseMapperX<ShopInfoDO> {

    default PageResult<ShopInfoDO> selectPage(ShopInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopInfoDO>()
                .eqIfPresent(ShopInfoDO::getCoverKey, reqVO.getCoverKey())
                .eqIfPresent(ShopInfoDO::getPicKeys, reqVO.getPicKeys())
                .eqIfPresent(ShopInfoDO::getOpenRemarks, reqVO.getOpenRemarks())
                .eqIfPresent(ShopInfoDO::getProvince, reqVO.getProvince())
                .eqIfPresent(ShopInfoDO::getCity, reqVO.getCity())
                .eqIfPresent(ShopInfoDO::getDistrict, reqVO.getDistrict())
                .eqIfPresent(ShopInfoDO::getAddress, reqVO.getAddress())
                .eqIfPresent(ShopInfoDO::getPickCount, reqVO.getPickCount())
                .eqIfPresent(ShopInfoDO::getStarCount, reqVO.getStarCount())
                .eqIfPresent(ShopInfoDO::getStar, reqVO.getStar())
                .betweenIfPresent(ShopInfoDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ShopInfoDO::getBrandId, reqVO.getBrandId())
                .likeIfPresent(ShopInfoDO::getShopName, reqVO.getShopName())
                .eqIfPresent(ShopInfoDO::getShopAbstract, reqVO.getShopAbstract())
                .eqIfPresent(ShopInfoDO::getMobile, reqVO.getMobile())
                .eqIfPresent(ShopInfoDO::getLongitude, reqVO.getLongitude())
                .eqIfPresent(ShopInfoDO::getLatitude, reqVO.getLatitude())
                .eqIfPresent(ShopInfoDO::getDescAddress, reqVO.getDescAddress())
                .eqIfPresent(ShopInfoDO::getStatus, reqVO.getStatus())
                .orderByDesc(ShopInfoDO::getId));
    }

}